<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript">

        function GetData() {
            var xhr = new XMLHttpRequest();
            xhr.open("GET", "http://localhost:8989/", true);
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                    if (xhr.status == 200) {
                        document.getElementById("div").innerHTML = xhr.responseText;
                    }
                }
            };
            xhr.send(null);
        }

    </script>
</head>

<body>
<input type="button" value="获取数据" onclick="GetData()"/>
<div id="div"></div>
</body>
</html>